package fr.labri.macchiato.core.service;

import java.util.List;
import java.util.Set;

import fr.labri.macchiato.core.api.Finder;
import fr.labri.macchiato.core.model.BusinessEntity;
import fr.labri.macchiato.core.technical.Callback;

/**
 * Retrieves and updates the data from the database
 * 
 * @author Michelle AVOMO
 * 
 */
public class BusinessEntityService {

	private Set<Finder> finders;

	/**
	 * Default constructor
	 */
	public BusinessEntityService() {

	}

	/**
	 * Constructor with an object that finds the business entities match in the
	 * database
	 * 
	 * @param finder
	 */
	public BusinessEntityService(Set<Finder> finders) {
		this.finders = finders;

	}

	/**
	 * 
	 * 
	 * @param callback
	 *            : list of the details page and infos for each b.i
	 */
	public void getDetailsBusinessEntities(
			Callback<List<BusinessEntity>> callback) {
		for (Finder finder : finders)
			finder.getBusinessEntities(callback);
	}

//	/**
//	 * 
//	 * @param field
//	 *            : business entity to be updated
//	 */
//	public void updateBusinessEntity(String field) {
//		// TODO: updating values in the database if changed . That assumes that
//		// we an administration module for the database.
//	}

}
